//
//  RootTabBarController.m
//  UI10_作业
//
//  Created by dllo on 16/3/22.
//  Copyright © 2016年 付冬梅. All rights reserved.
//

#import "RootTabBarController.h"
#import "ViewController.h"
#import "FirstNavigationViewController.h"
#import "SecondViewController.h"
#import "SeondNavigationViewController.h"

@interface RootTabBarController ()

@end

@implementation RootTabBarController

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.viewControllers = [self createRootTabBar];
    }
    return self;
}

- (NSMutableArray <UINavigationController *>*)createRootTabBar {
    NSMutableArray *viewControllersArr = [NSMutableArray array];
    
    /** 第一页联系人 */
    ViewController *firstVc = [[ViewController alloc] init];
    FirstNavigationViewController *firstNav = [[FirstNavigationViewController alloc] initWithRootViewController:firstVc];
    firstNav.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"联系人" image:[UIImage imageNamed:@"iconfont-lianxiren"] tag:1000];
    [viewControllersArr addObject:firstNav];
    
    /** 第二页联系人详情 */
    SecondViewController *secVc = [[SecondViewController alloc] init];
    SeondNavigationViewController *secNav = [[SeondNavigationViewController alloc] initWithRootViewController:secVc];
    secNav.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"短信" image:[UIImage imageNamed:@"iconfont-xiangqing"] tag:1001];
    [viewControllersArr addObject:secNav];
    
    [self.tabBar setTintColor:[UIColor redColor]];
    [self.tabBar setBarTintColor:[UIColor yellowColor]];
    return viewControllersArr;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
